package threadPoolExecutorDemo;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

public class Demo3 {
    public static void main(String[] args) {
        ExecutorService threadPool = Executors.newFixedThreadPool(2);
        for (int i = 0; i < 10; i++) {
            int id = i;
            threadPool.submit(() -> {
                System.out.println("hello " + id + ", " + Thread.currentThread().getName());
            });
        }
    }
}
